<script lang="ts" setup>
import axios from 'axios';
import { ref } from 'vue';
import { useRouter } from 'vue-router';
let router=useRouter();
let form = ref({
    username: "",
    password: "",
})
function insertUser(){
    axios.post("http://localhost:8080/api/insertUser",form.value).then(()=>{
        router.push("/")
    })
}
</script>
<template>
    <h1>注册账号</h1>
    <el-form :model="form" label-width="120px" style="max-width: 600px">
        <el-form-item label="用户名">
            <el-input v-model="form.username" />
        </el-form-item>
        <el-form-item label="密码">
            <el-input v-model="form.password" />
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="insertUser">注册</el-button>
        </el-form-item>
    </el-form>
</template>